#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: henry_oulen@163.com
@file: factory.py
@time: 2023/10/26 15:20
@desc: 
"""
from backend.tvadmin.utils.mysql_base import MysqlSqlalchemy, MysqlBase, SqlAlBase
from sqlalchemy import Column, Integer, String, DateTime, Boolean, Float
from backend.tvadmin.utils.model_utils import ModelBase

from backend.conf import config


class Factory(ModelBase, SqlAlBase.base):
    __tablename__ = config.table_prefix + 'system_factory'
    factory_name = Column(String(30), nullable=False)  # 工厂名称
    license_id = Column(String(30), nullable=False, unique=True)  # 营业执照 具有唯一性
    factory_id = Column(String(30), nullable=False, unique=True)  # 工厂id
    phone = Column(String(30), nullable=False, unique=True, comment="用户登陆手机号")  # 用户登录手机号


def select():
    session = MysqlSqlalchemy().session
    result = session.query(Factory).filter().all()
    print(result)
    for i in result:
        print(i.id)


if __name__ == '__main__':
    # 执行此代码，就会把创建好的 Module 映射到数据库中
    # Base.metadata.create_all(engine)
    select()
